LearningStoreJob.UpdateItem Method

Update properties on an item

Parent Type: LearningStoreJob

Namespace: Microsoft.LearningComponents.Storage

Assembly: Microsoft.LearningComponents.Storage.dll

Syntax
C#

public void UpdateItem (
LearningStoreItemIdentifier id,
IDictionary<string,object> propertyValues

)

Parameters

id

Identifies the item being updated.

propertyValues

Property values to be updated. The key is the property name, and the value is the value to be placed in the property.

Exceptions
Exception type Condition
ArgumentNullException

id or propertyValues is a null reference.

Microsoft.LearningComponents.Storage.LearningStoreItemNotFoundException

The item was not found in the store.

System.InvalidOperationException

A property name passed in propertyValues doesn't exist on the item or a property value passed in propertyValues is not a valid value for the corresponding property.

Remarks

Steps required to update an item in the store:

propertyValues should contain one entry for each property that should be changed. The value type differs depending on the type of the property on the item: Null or DBNull.Value are also permitted, assuming that the property is nullable.

This operation does not return anything as a result.

Example

The following code updates the name of the user item with an Id of 50:

C#
// Create the property values
Dictionary<string,object> propertyValues = new Dictionary<string,object>();
propertyValues["Name"] = "John Doe";
 
// Create the job and add the "update properties" operation
LearningStoreJob job = store.CreateJob();
LearningStoreItemIdentifier id = new LearningStoreItemIdentifier("UserItem", 50);
job.UpdateItem(id, propertyValues);
 
// Execute the job
job.Execute();